package com.eastfair.venueservice.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.eastfair.boot.request.PageParams;
import com.eastfair.boot.service.SuperService;
import com.eastfair.core.base.R;
import com.eastfair.projectcore.enumeration.DataIsolationSystemSceneEnum;
import com.eastfair.venueservice.dto.ServiceItemDTO;
import com.eastfair.venueservice.dto.ServiceItemQuery;
import com.eastfair.venueservice.entity.ServiceItem;
import com.eastfair.venueservice.entity.ServiceOrder;
import com.eastfair.venueservice.vo.ServiceItemVO;
import com.eastfair.venueservice.vo.ServicePriceListVO;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 业务接口
 * 服务项
 * </p>
 *
 * @author linan
 * @date 2022-07-13
 */
public interface ServiceItemService extends SuperService<ServiceItem> {

    /**
     * 添加服务项
     * @param serviceItemDTO serviceItemDTO
     * @return R<?>
     */
    R<Boolean> addServiceItem(ServiceItemDTO serviceItemDTO);

    /**
     * 更新服务项
     * @param serviceItemDTO serviceItemDTO
     * @return R<?>
     */
    R<Boolean> updateServiceItem(ServiceItemDTO serviceItemDTO);

    /**
     * 服务项列表
     * @param serviceItemQuery serviceItemQuery
     * @return IPage<ServiceItemVO>
     */
    IPage<ServiceItemVO> queryServiceItem(PageParams<ServiceItemQuery> serviceItemQuery);

    /**
     * 服务上架、下架
     * @param serviceItemDTO
     * @return
     */
    R<?> updateServiceItemState(ServiceItemDTO serviceItemDTO);

    /**
     * 删除服务项
     * @param serviceItemDTO
     * @return
     */
    R<?> delServiceItem(ServiceItemDTO serviceItemDTO,Boolean isPriceCancel);

    /**
     * 根据ID查询服务详情信息
     * @return
     */
    ServiceItem getServiceItemById(Long id);

    /**
     * 审核通过后同步服务
     * @param id
     */
    void addServiceItemAfterAudit(Long id);

    /**
     * 简单查询服务项列表（不分页）
     * @param serviceItemQuery
     * @return
     */
    List<ServiceItemVO> queryServiceItemSimpleList(ServiceItemQuery serviceItemQuery);

    /**
     * 通过展会ID删除服务
     * @param exhibitionManageId exhibitionManageId
     * @param scene  scene
     */
    void removeByExhibition(Long exhibitionManageId, List<DataIsolationSystemSceneEnum> scene);

    /**
     * 同步服务
     * @param id
     * @param data data
     * @param pCompositeCourt
     */
    void syncServiceItem(Long id, ServicePriceListVO data, DataIsolationSystemSceneEnum pCompositeCourt,Long serviceProviderId);

    /**
     * 修改服务项库存
     * @param serviceItemDTO
     * @return
     */
    R<Boolean> updateServiceItemInventory(ServiceItemDTO serviceItemDTO);

    /**
     * 通过服务分类的id查询服务项数量
     * @param serviceCategoryId
     * @param serviceProviderId
     * @return
     */
    Integer getServiceItemSumByCategoryId(Long serviceCategoryId, Long serviceProviderId);

    /**
     * 搭建商准备预订服务的服务列表
     * @param serviceItemQuery serviceItemQuery
     * @return IPage<ServiceItemVO>
     */
    List<ServiceItemVO> queryServiceItemOfSubscribe(PageParams<ServiceItemQuery> serviceItemQuery);

    /**
     * 同步服务
     * @param serviceItemDTO
     * @return
     */
    R<Boolean> syncServiceItem(ServiceItemDTO serviceItemDTO);

    /**
     * queryServiceItemOfTransport
     * @param serviceItemQuery
     * @return
     */
    List<ServiceItemVO> queryServiceItemOfTransport(ServiceItemQuery serviceItemQuery);

    /**
     * 场馆现场预订服务的服务列表
     * @param serviceItemQuery
     * @return
     */
    List<ServiceItemVO>  queryServiceItemOfVenue(ServiceItemQuery serviceItemQuery);

    /**
     * 查询最底层的服务来源
     * @param sourceId
     * @return
     */
    ServiceItem getDeapSourceServiceItem(Long sourceId);

    /**
     * 服务库存预警
     * @param serviceOrder
     */
    void warning(ServiceOrder serviceOrder);

    /**
     * 服务库存预警(报馆触发)
     * @param homeId
     * @param exhibitionManageId
     */
    void waring(Long homeId, Long exhibitionManageId);

    /**
     * 发送配套上服务提交审核的站内信.
     *
     * @param serviceItem the service item
     * @return the boolean
     */
    boolean sendMatchingServiceSubmitInnerMsg(ServiceItemDTO serviceItem);

    /**
     * Async 发送配套上服务提交审核的站内信.
     *
     * @param serviceItem the service item
     */
    void asyncSendMatchingServiceSubmitInnerMsg(ServiceItemDTO serviceItem);

    /**
     * 导出服务
     * @param serviceItemDTO
     * @param response
     */
    void exportServiceItem(ServiceItemDTO serviceItemDTO, HttpServletResponse response) throws Exception ;

    /**
     * 查询价目下的规格
     * @param exhibitionManageId
     * @return
     */
    List<Long> queryCategoryIds(Long exhibitionManageId);

    /**
     * 主办准备预订服务的服务列表
     * @param serviceItemQuery serviceItemQuery
     * @return List<ServiceItemVO>
     */
    List<ServiceItemVO> queryServiceItemOfSponsor(ServiceItemQuery serviceItemQuery);

    /**
     * 来源服务ID列表查询服务项列表
     *
     * @param sourceIdList the source id list
     * @return the list
     */
    List<ServiceItem> listBySourceIdList(List<Long> sourceIdList);
}
